package org.hongqi.common.senpec.sys.department;

import lombok.RequiredArgsConstructor;
import org.hongqi.common.senpec.base.mybatisplus.IBaseController;
import org.hongqi.common.senpec.base.sevlet.Result;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Collection;

@RestController
@RequestMapping("/sys/departments")
@RequiredArgsConstructor
public class DepartmentController implements IBaseController<Department> {
    private final DepartmentService departmentService;

    @Override
    public Result<Department> save(Department entity) {
        return departmentService.mySave(entity);
    }

    @Override
    public Result<?> removeById(Long id) {
        return departmentService.myRemoveById(id);
    }

    @Override
    public Result<Department> updateById(Department entity) {
        return departmentService.myUpdateById(entity);
    }

    @Override
    public Result<Department> getById(Long id) {
        return departmentService.myGetById(id);
    }

    @Override
    public Result<Collection<Department>> listTree(Department entity) {
        return departmentService.myListTree(entity);
    }

}
